﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dapper.Data.Service;
using Dapper.Modle;
using Dapper.Orm;
using Dapper.Core;


namespace Dapper.Data.Implement
{
    public class UserDataImpl : ActionDateImpl<User>,IUserDateService
    {

        public User GetUserByUserNameAndPassWord(string userName, string passWord)
        {
            try
            {
                Sql sql = new Sql();
                passWord = Tools.MD5(passWord);
                sql.Select("Users.*").From("Users").Where("UserName=@0 and PassWord=@1", userName, passWord);
                User user = DateService.IUserDateService.SingleOrDefault(sql);
                if (null != user)
                {
                    return user;
                }
                return null;
            }
            catch
            {
                return null;
            }
        }
    }
}
